using System;
using JH;
using UnityEngine;

public class TestChart : MonoBehaviour
{
    [SerializeField] private Vector2LineChart chart;
    private float _t; 

    private void Start()
    {
        chart.Clear();
    }

    void Update()
    {
        _t += Time.deltaTime; 
        float noise = Mathf.PerlinNoise(_t, 0f) * 0.4f - 0.2f; 
        float y = Mathf.Sin(_t) + noise;
        chart.AddPoint(new Vector2(_t, y));
    }

    private void OnValidate()
    {
       if(chart ==  null) chart = FindAnyObjectByType<Vector2LineChart>();
    }
}